package graphics;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Point;
import javax.swing.JPanel;
import javax.swing.border.LineBorder;

/**
 *
 * @author mateusz
 */
public class FullScreenWindow extends CustomWindow {

    /**
     * 
     */
    public JPanel bottomPanel;
    /**
     * 
     */
    public JPanel middlePanel;
    /**
     * 
     */
    public JPanel topPanel;
    //public JLayeredPane mainPanel;

    /**
     * 
     * @param name
     * @param size
     * @param position
     * @param mainPanelSize
     */
    public FullScreenWindow( String name, Dimension size, Point position,
                             Dimension mainPanelSize ) {
        this( name, size.width, size.height, position.x, position.y,
                mainPanelSize.width, mainPanelSize.height );
    }

    /**
     * 
     * @param name
     * @param width
     * @param height
     * @param posX
     * @param posY
     * @param mainPanelWidth
     * @param mainPanelHeight
     */
    public FullScreenWindow( String name, int width, int height, int posX,
                             int posY, int mainPanelWidth, int mainPanelHeight ) {
        super( name, width, height, posX, posY );

        bottomPanel = null;

        setLayout( new FlowLayout( FlowLayout.LEFT ) );

        addMainPanel();
        //mainPanel = new JLayeredPane();
        // mainPanel.setBorder( new LineBorder( Color.black ) );
        //add( mainPanel );

        mainPanel.setLayout( null );

        // set main panel size
        Dimension size = new Dimension( mainPanelWidth, mainPanelHeight );
        /*
        mainPanel.setMinimumSize( size );
        mainPanel.setMaximumSize( size );
        mainPanel.setSize( size );
        mainPanel.setPreferredSize( size );
        */

        // conf panels
        bottomPanel = makePanel( size, Color.BLACK );
        middlePanel = makePanel( size, Color.BLUE );
        topPanel = makePanel( size, Color.GRAY );

        topPanel.setBorder( new LineBorder( Color.black ) );

        mainPanel.add( topPanel );
        mainPanel.add( middlePanel );
        mainPanel.add( bottomPanel );



        if ( bottomPanel == null ) {
            System.out.println( "null!" );

        }

        // add main panel to content pane
        //pack();
        validate();
    }

    private JPanel makePanel( Dimension size, Color c ) {
        JPanel panel = new JPanel();
        /*
        panel.setPreferredSize( size );
        panel.setMinimumSize( size );
        panel.setMaximumSize( size );
        panel.setSize( size );
        */
        //panel.setBackground( c );
        //panel.setBorder( new LineBorder( c ) );
        panel.setLayout( null );
        panel.setOpaque( false );

        return panel;
    }
}
